package com.briup.mybatis01code.mapper;

import com.briup.mybatis01code.entity.Book;
import com.briup.mybatis01code.entity.extend.BookExtend;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

@Mapper
@Component
public interface BookMapper {
    Book findById(Integer id);

    @Select("select *  from es_book where id=#{id}")
    @Results({
            @Result(column = "category_id",property ="categoryId" ),
            @Result(column = "store_num",property ="storeNum" ),
            @Result(property = "category" ,column = "category_id",one = @One(select = "com.briup.mybatis01code.mapper.CategoryMapper.findById"))
    })
    BookExtend findById2(Integer id);
}
